<?php

/**
 * PedidoProducto form base class.
 *
 * @method PedidoProducto getObject() Returns the current form's model object
 *
 * @package    zing
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BasePedidoProductoForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                        => new sfWidgetFormInputHidden(),
      'idPedido'                  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Pedido'), 'add_empty' => true)),
      'idProducto'                => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Producto'), 'add_empty' => true)),
      'cantidad'                  => new sfWidgetFormInputText(),
      'datosAdicionales'          => new sfWidgetFormInputText(),
      'precio'                    => new sfWidgetFormInputText(),
      'precioUnitario'            => new sfWidgetFormInputText(),
      'fechaEntrega'              => new sfWidgetFormDateTime(),
      'realizado'                 => new sfWidgetFormInputCheckbox(),
      'idPedidoProductoPrevio'    => new sfWidgetFormInputText(),
      'idPedidoProductoPosterior' => new sfWidgetFormInputText(),
      'created_at'                => new sfWidgetFormDateTime(),
      'updated_at'                => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                        => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'idPedido'                  => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Pedido'), 'required' => false)),
      'idProducto'                => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Producto'), 'required' => false)),
      'cantidad'                  => new sfValidatorInteger(array('required' => false)),
      'datosAdicionales'          => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'precio'                    => new sfValidatorNumber(array('required' => false)),
      'precioUnitario'            => new sfValidatorNumber(array('required' => false)),
      'fechaEntrega'              => new sfValidatorDateTime(array('required' => false)),
      'realizado'                 => new sfValidatorBoolean(array('required' => false)),
      'idPedidoProductoPrevio'    => new sfValidatorInteger(array('required' => false)),
      'idPedidoProductoPosterior' => new sfValidatorInteger(array('required' => false)),
      'created_at'                => new sfValidatorDateTime(),
      'updated_at'                => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('pedido_producto[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'PedidoProducto';
  }

}
